package com.haima.sage.bigdata.api.frame.datatype.impl;

import com.haima.sage.bigdata.api.frame.datatype.DataTypeService;

public class DoubleDataTypeService extends DataTypeService<Double> {
    @Override
    public Double trans(Object value) {
        if (null == value) {
            return null;
        }
        if (value instanceof Number) {
            return ((Number) value).doubleValue();
        }

        String dist = value.toString().trim();
        // TODO config for pattern, parse which faster
        return Double.parseDouble(dist);
    }

}
